#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(int i=s;i<=t;i++)
#define  ll long long
const int N=1e6+5,mod=1e9+7,INF=0x3f3f3f3f;

struct node{
    ll x,c;
    friend bool operator<(node a,node b){
        if(a.c==b.c)return a.x<b.x;
        return a.c<b.c;
    }
}st[N],sr[N];
ll a[N];
ll c[N];
ll r[N],t[N];
int main()
{
    freopen("equal.in", "r", stdin);
    freopen("equal.out", "w", stdout);
    int n;
    scanf("%d",&n);

    rep(i,1,n)scanf("%lld",&a[i]),c[a[i]]++;
    int cnt=0,top=0;

    ll lcm=1;
    rep(i,1,N-1)if(c[i])
        {
            int flag=0;
            for(int j=i+i;j<N;j+=i)if(c[j]){
                    flag=j;
                    break;
                }
            if(flag)sr[++cnt]=node{i,c[i]};
            st[++top]=node{i,c[i]};
            if(lcm<N)lcm=lcm*i/__gcd(lcm,(ll)i);
        }
    sort(sr+1,sr+1+cnt);
    sort(st+1,st+1+top);
    rep(i,1,cnt)r[i]=r[i-1]+sr[i].c;
    rep(i,1,top)t[i]=t[i-1]+st[i].c;
    printf("%d",top);
    int last=top;
    for(int i=1;i<=n;i++)
    {
        int ans=last;
        if(i<=r[cnt]){ //可以变为倍数
            int x=upper_bound(r+1,r+cnt+1,i)-r-1;
            ans=min(ans,top-x);
            //cout<<"  "<<x;
        }
        int x=upper_bound(t+1,t+1+top,i)-t-1;
        //cout<<"   "<<x<<endl;
        ans=min(ans,top-x+(lcm!=st[top].x));
        if(i==n)ans=1;
        printf(" %d",ans);
        last=ans;
    }
    printf("\n");
}